﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _10._1
{
    internal class MyClass
    {
        public readonly string Name;
        public string LongName;
        private int intVal;
        public int Val
        {
            get { return intVal; }
            set
            {
                if (value >= 0 && value <= 10)
                    intVal = value;
                else
                    throw (new ArgumentOutOfRangeException("Val", value, "Val must be assigned a value between 0 and 10."));
            }
        }
        
        public override string ToString()
        {
            return "Name: "+Name+"\nVal: "+ Val;
        }

        private MyClass():this("Default Name") { }
        public MyClass(string name)
        {
            this.Name = name;
            intVal = 0;
        }
        private int MyDoubledInt = 5;
        public int MyDoubliedIntProp => (MyDoubledInt * 2);

    }
}
